﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CodeDemon.Models;
using System.Data;

namespace SynchUsers
{
	class Program
	{
		static void Main(string[] args)
		{
			System.Xml.XmlReader xRead = System.Xml.XmlReader.Create("list.xml");
			System.Xml.Linq.XDocument xDoc = System.Xml.Linq.XDocument.Load(xRead);
			ReviewModel model = new ReviewModel();
			foreach (var f in xDoc.Descendants("user"))
			{
				int userCount = (from users in model.DAO.GetUserByEmail(f.Element("login_name").Value) select users).Count();
				if (userCount == 0)
				{
					model.DAO.InsertUser(f.Element("login_name").Value, f.Element("crypt_pass").Value, f.Element("real_name").Value, f.Element("svn_uid").Value);
				}
			}
		}
	}
}
